package io.zhengsh.util;

public class RandomUtil {

    public static int randomNum(int max) {
        return (int) (Math.random() * max);
    }

    public static void randomSleep() {
        try {
            Thread.sleep(randomNum(5500));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void randomSleepByWorkDate() {
        try {
            int offset = DateTimeUtil.isWorkTime() ? 2: 32;
            Thread.sleep(randomNum(5500) * offset);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
